//http://tb1.bdstatic.com/??/tb/_/pay_util_e0a3684.js,/tb/_/medal_549f6f1.js,/tb/_/paypost_data_70c1ba1.js,/tb/_/paypost_agree_dialog_a4c48b3.js,/tb/_/paypost_editor_7d000d4.js,/tb/_/paypost_867d76a.js

_.Module.define({
	path: "encourage-payment/widget/pay_util",
	sub: {
		initial: function() {}
	}
});

! function() {
	var n = {},
		t = null,
		e = function() {};
	e.prototype = {
		set: function(t, e) {
			return n[t] = e, !0
		},
		get: function(t) {
			return n[t] ? n[t] : null
		}
	}, _.Module.define({
		path: "encourage-thread/widget/paypost_data",
		sub: {
			initial: function() {},
			getInstance: function() {
				return t || (t = new e), t
			}
		}
	})
}(window);
_.Module.define({
	path: "encourage-thread/widget/paypost_agree_dialog",
	requires: ["encourage-thread/widget/paypost_data"],
	sub: {
		dialog: null,
		nextFnStack: [],
		tpl: ["<div>", "<h3>\u8d34\u5427\u201c\u4ed8\u8d39\u53ef\u89c1\u201d\u529f\u80fd\u7528\u6237\u4f7f\u7528\u534f\u8bae</h3>", '<div class="scroll_section">', "<ul>", "<li><b>\u3010\u9996\u90e8\u53ca\u5bfc\u9009\u3011</b></li>", "<li>\u4efb\u4f55\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u7684\u53d1\u8d34\u548c\u6d4f\u89c8\u7528\u6237\uff08\u4ee5\u4e0b\u7edf\u79f0\u4e3a\u201c\u60a8\u201d\uff09\u5747\u5e94\u4ed4\u7ec6\u9605\u8bfb\u987b\u77e5\uff0c\u7528\u6237\u53d1\u8d34\u548c\u6d4f\u89c8\u7684\u884c\u4e3a\u5c06\u88ab\u89c6\u4e3a\u5bf9\u672c\u987b\u77e5\u5168\u90e8\u5185\u5bb9\u7684\u8ba4\u53ef\u3002\u672c\u987b\u77e5\u89c6\u4e3a\u300a\u767e\u5ea6\u514d\u8d23\u58f0\u660e\u300b\u3001\u300a\u8d34\u5427\u534f\u8bae\u300b\u3001\u300a\u5427\u4e3b\u5236\u5ea6\u300b\u3001\u300aT\u8c46\u4f7f\u7528\u987b\u77e5\u300b\u7684\u8865\u5145\u89c4\u5b9a\uff0c\u662f\u5176\u4e0d\u53ef\u5206\u5272\u7684\u7ec4\u6210\u90e8\u5206\uff0c\u4e0e\u5176\u6784\u6210\u7edf\u4e00\u6574\u4f53\u3002\u672c\u987b\u77e5\u4e0e\u4e0a\u8ff0\u5185\u5bb9\u5b58\u5728\u51b2\u7a81\u7684\uff0c\u4ee5\u672c\u89c4\u5219\u4e3a\u51c6\u3002\u672c\u987b\u77e5\u5185\u5bb9\u540c\u65f6\u5305\u62ec\u767e\u5ea6\u53ef\u80fd\u4e0d\u65ad\u53d1\u8868\u7684\u5173\u4e8e\u672c\u987b\u77e5\u7684\u76f8\u5173\u89c4\u5219\u3001\u4e1a\u52a1\u89c4\u5219\u7b49\u5185\u5bb9\u3002\u4e0a\u8ff0\u5185\u5bb9\u4e00\u7ecf\u6b63\u5f0f\u53d1\u8868\uff0c\u5373\u4e3a\u672c\u987b\u77e5\u4e0d\u53ef\u5206\u5272\u7684\u7ec4\u6210\u90e8\u5206\uff0c\u60a8\u540c\u6837\u5e94\u5f53\u9075\u5b88\u3002</li>", "<li><b>\u7b2c\u4e00\u7ae0 \u4ec0\u4e48\u662f\u8d34\u5b50\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u8d34\u5b50\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd</b></li>", "<li>\u7528\u6237\u4e3a\u6d4f\u89c8\u4f18\u8d28\u5185\u5bb9\u800c\u5411\u8d34\u5427\u53d1\u8d34\u7528\u6237\u4ed8\u8d39\u7684\u529f\u80fd\u3002<br />\u60a8\u5728\u5427\u5185\u5347\u81f36\u7ea7\u5373\u53ef\u5f00\u542f\u8be5\u529f\u80fd\uff0c\u5728\u53d1\u8d34\u6846\u70b9\u51fb\u201c\u4ed8\u8d39\u53ef\u89c1\u201d\u6309\u94ae\u6253\u5f00\u4ed8\u8d39\u5185\u5bb9\u7f16\u8f91\u533a\uff0c\u7f16\u8f91\u533a\u4e0a\u65b9\u6587\u672c\u6846\u8f93\u5165\u552e\u4ef7\uff08\u5373\u51fa\u552e\u7684T\u8c46\u6570\uff09\uff0c\u7136\u540e\u5728\u4ed8\u8d39\u533a\u57df\u548c\u6b63\u5e38\u533a\u57df\u5206\u522b\u7f16\u8f91\u5b8c\u6210\u540e\u70b9\u51fb\u201c\u53d1\u8868\u201d\u5373\u53ef\u3002</li>", "<li><b>\u7b2c\u4e8c\u7ae0 \u8d23\u4efb\u6761\u6b3e</b></li>", "<li>\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u8fc7\u7a0b\u4e2d\u6240\u521b\u9020\u7684\u5185\u5bb9\uff0c\u5747\u6765\u81ea\u70ed\u5fc3\u7528\u6237\u7684\u79ef\u6781\u53d1\u8868\u3002\u767e\u5ea6\u81ea\u8eab\u4e0d\u7f16\u8f91\u6216\u4fee\u6539\u7528\u6237\u53d1\u8868\u7684\u5185\u5bb9\u3002\u5bf9\u4e8e\u7528\u6237\u5728\u4f7f\u7528\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u8fc7\u7a0b\u4e2d\u6240\u53d1\u8868\u5185\u5bb9\u7684\u771f\u5b9e\u6027\u5f15\u53d1\u7684\u5168\u90e8\u8d23\u4efb\uff0c\u7531\u7528\u6237\u81ea\u884c\u627f\u62c5\u3002\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u7684\u7528\u6237\u4e0d\u80fd\u4fb5\u72af\u5305\u62ec\u4ed6\u4eba\u7684\u8457\u4f5c\u6743\u5728\u5185\u7684\u77e5\u8bc6\u4ea7\u6743\u4ee5\u53ca\u5176\u4ed6\u6743\u5229\u3002\u4e00\u65e6\u7531\u4e8e\u7528\u6237\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u8fc7\u7a0b\u4e2d\u53d1\u8868\u7684\u5185\u5bb9\u53d1\u751f\u6743\u5229\u7ea0\u7eb7\u6216\u4fb5\u72af\u4e86\u4efb\u4f55\u7b2c\u4e09\u65b9\u7684\u5408\u6cd5\u6743\u76ca\uff0c\u5176\u8d23\u4efb\u7531\u7528\u6237\u672c\u4eba\u627f\u62c5\uff0c\u56e0\u6b64\u7ed9\u767e\u5ea6\u6216\u4efb\u4f55\u7b2c\u4e09\u65b9\u9020\u6210\u635f\u5931\u7684\uff0c\u7528\u6237\u5e94\u8d1f\u8d23\u5168\u989d\u8d54\u507f\u3002</li>", "<li>\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u7684\u7528\u6237\u53ef\u4ee5\u4e3a\u4ecb\u7ecd\u3001\u8bc4\u8bba\u3001\u7814\u7a76\u7b49\u76ee\u7684\uff0c\u5728\u5408\u7406\u7684\u8303\u56f4\u5185\u9002\u5f53\u5f15\u7528\u4ed6\u4eba\u5df2\u7ecf\u53d1\u8868\u7684\u4f5c\u54c1\uff0c\u4f46\u5e94\u5f53\u6ce8\u660e\u4f5c\u8005\u59d3\u540d\u3001\u4f5c\u54c1\u540d\u79f0\uff0c\u5e76\u4e0d\u5f97\u4fb5\u72af\u8457\u4f5c\u6743\u4eba\u53ca\u5176\u4ed6\u6743\u5229\u4eba\u7684\u5408\u6cd5\u6743\u76ca\u3002</li>", "<li>\u7528\u6237\u627f\u8bfa\uff1a\u5176\u5728\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u8fc7\u7a0b\u4e2d\u6240\u53d1\u8868\u7684\u6240\u6709\u5185\u5bb9\u7b26\u5408\u4e2d\u56fd\u6cd5\u5f8b\u6cd5\u89c4\u548c\u89c4\u8303\u6027\u6587\u4ef6\u7684\u76f8\u5173\u89c4\u5b9a\uff0c\u4e0d\u4fb5\u72af\u4efb\u4f55\u7b2c\u4e09\u65b9\u7684\u5408\u6cd5\u6743\u76ca\u3002\u5982\u7528\u6237\u8fdd\u53cd\u524d\u8ff0\u4fdd\u8bc1\uff0c\u767e\u5ea6\u8d34\u5427\u6709\u6743\u5220\u9664\u76f8\u5173\u6587\u672c\u548c\u9644\u4ef6\u5185\u5bb9\uff0c\u5e76\u53ef\u4ee5\u6682\u505c\u6216\u7ec8\u6b62\u5411\u8be5\u7528\u6237\u63d0\u4f9b\u670d\u52a1\u3002\u5982\u56e0\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u7684\u7528\u6237\u53d1\u8868\u7684\u5185\u5bb9\u4fb5\u72af\u4e86\u7b2c\u4e09\u65b9\u7684\u5408\u6cd5\u6743\u5229\uff0c\u7b2c\u4e09\u65b9\u5411\u767e\u5ea6\u63d0\u51fa\u5f02\u8bae\uff0c\u767e\u5ea6\u8d34\u5427\u6709\u6743\u5220\u9664\u76f8\u5173\u7684\u5185\u5bb9\u3002\u63d0\u51fa\u5f02\u8bae\u8005\u548c\u5185\u5bb9\u53d1\u8868\u8005\u4e4b\u95f4\u7684\u76f8\u5173\u6cd5\u5f8b\u95ee\u9898\u5f97\u5230\u89e3\u51b3\u540e\uff0c\u4ee5\u6b64\u4e3a\u4f9d\u636e\uff0c\u5411\u767e\u5ea6\u8d34\u5427\u63d0\u51fa\u7533\u8bf7\uff0c\u767e\u5ea6\u8d34\u5427\u53ef\u4ee5\u6062\u590d\u88ab\u5220\u9664\u7684\u5185\u5bb9\u3002\u5bf9\u4e8e\u7528\u6237\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u8fc7\u7a0b\u4e2d\u53d1\u8868\u7684\u4efb\u4f55\u5185\u5bb9\uff0c\u7528\u6237\u540c\u610f\u767e\u5ea6\u5728\u5168\u4e16\u754c\u8303\u56f4\u5185\u4eab\u6709\u514d\u8d39\u7684\u3001\u6c38\u4e45\u7684\u3001\u4e0d\u53ef\u64a4\u9500\u7684\u3001\u975e\u6392\u4ed6\u6027\u7684\u4f7f\u7528\u548c\u518d\u8bb8\u53ef\u7684\u6743\u5229\u3002\u767e\u5ea6\u4eab\u6709\u4fee\u6539\u3001\u590d\u5236\u3001\u53d1\u884c\u3001\u8868\u6f14\u3001\u5c55\u89c8\u3001\u4fe1\u606f\u7f51\u7edc\u4f20\u64ad\u3001\u6539\u7f16\u3001\u7ffb\u8bd1\u3001\u6c47\u7f16\u7b49\u6743\u5229\u3002\u540c\u65f6\uff0c\u5bf9\u4e8e\u7528\u6237\u4f7f\u7528\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u8fc7\u7a0b\u4e2d\u53d1\u8868\u5185\u5bb9\u7684\u4fb5\u6743\u884c\u4e3a\uff0c\u7528\u6237\u6388\u6743\u767e\u5ea6\u5728\u5168\u4e16\u754c\u8303\u56f4\u5185\u8fdb\u884c\u7ef4\u6743\u3002</li>", "<li><b>\u7b2c\u4e09\u7ae0 \u672c\u987b\u77e5\u9879\u4e0b\u670d\u52a1\u7684\u53d8\u66f4\u3001\u4e2d\u6b62\u6216\u7ec8\u6b62</b></li>", "<li>\u60a8\u5145\u5206\u4e86\u89e3\u5e76\u540c\u610f\uff0c\u7531\u4e8e\u4e92\u8054\u7f51\u670d\u52a1\u7684\u7279\u6b8a\u6027\uff0c\u767e\u5ea6\u53ef\u80fd\u4f1a\u6309\u7167\u76f8\u5173\u6cd5\u89c4\u3001\u53cc\u65b9\u7ea6\u5b9a\u6216\u5728\u5176\u4ed6\u5fc5\u8981\u65f6\uff0c\u4e2d\u6b62\u6216\u7ec8\u6b62\u5411\u60a8\u63d0\u4f9b\u76f8\u5e94\u670d\u52a1\uff0c\u5c4a\u65f6\uff0c\u767e\u5ea6\u4f1a\u4f9d\u6cd5\u4fdd\u62a4\u60a8\u7684\u5408\u6cd5\u6743\u76ca\u3002</li>", "<li><b>\u7b2c\u56db\u7ae0 \u9644\u5219</b></li>", "<li>\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u53ef\u89c1\u529f\u80fd\u5982\u56e0\u7cfb\u7edf\u7ef4\u62a4\u6216\u5347\u7ea7\u7b49\u800c\u9700\u6682\u505c\u670d\u52a1\u65f6\uff0c\u5c06\u4e8b\u5148\u516c\u544a\u3002\u82e5\u56e0\u786c\u4ef6\u6545\u969c\u6216\u5176\u5b83\u4e0d\u53ef\u6297\u529b\u800c\u5bfc\u81f4\u6682\u505c\u670d\u52a1\uff0c\u4e8e\u6682\u505c\u670d\u52a1\u671f\u95f4\u9020\u6210\u7684\u4e00\u5207\u4e0d\u4fbf\u4e0e\u635f\u5931\uff0c\u767e\u5ea6\u8d34\u5427\u4e0d\u8d1f\u4efb\u4f55\u8d23\u4efb\u3002 \u7531\u4e8e\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u8d34\u7684\u8c03\u6574\u5bfc\u81f4\u4fe1\u606f\u4e22\u5931\u548c/\u6216\u5176\u4ed6\u7ed3\u679c\u7684\uff0c\u767e\u5ea6\u516c\u53f8\u4e0d\u627f\u62c5\u4efb\u4f55\u8d23\u4efb\u3002</li>", "<li>\u767e\u5ea6\u6709\u6743\u6839\u636e\u4e2d\u534e\u4eba\u6c11\u5171\u548c\u56fd\u6cd5\u5f8b\u3001\u6cd5\u89c4\u53ca\u89c4\u8303\u6027\u6587\u4ef6\u7684\u53d8\u5316\u4ee5\u53ca\u4e92\u8054\u7f51\u53ca\u81ea\u8eab\u4e1a\u52a1\u7684\u53d1\u5c55\u60c5\u51b5\uff0c\u4e0d\u65ad\u4fee\u6539\u548c\u5b8c\u5584\u5305\u62ec\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u8d34\u534f\u8bae\u5728\u5185\u7684\u767e\u5ea6\u8d34\u5427\u5e2e\u52a9\u7684\u76f8\u5173\u6761\u6b3e\u3002\u767e\u5ea6\u4fdd\u7559\u968f\u65f6\u4fee\u6539\u767e\u5ea6\u8d34\u5427\u4ed8\u8d39\u8d34\u534f\u8bae\u5728\u5185\u7684\u767e\u5ea6\u8d34\u5427\u5e2e\u52a9\u6761\u6b3e\u7684\u6743\u5229\u3002\u672c\u534f\u8bae\u672a\u6d89\u53ca\u7684\u95ee\u9898\u53c2\u89c1\u56fd\u5bb6\u6709\u5173\u6cd5\u5f8b\u6cd5\u89c4\uff0c\u5f53\u672c\u534f\u8bae\u4e0e\u56fd\u5bb6\u6cd5\u5f8b\u6cd5\u89c4\u51b2\u7a81\u65f6\uff0c\u4ee5\u56fd\u5bb6\u6cd5\u5f8b\u6cd5\u89c4\u4e3a\u51c6\u3002</li>", "</ul>", "</div>", '<div class="btn_group">', '<a href="javascript:;" class="btn_default btn_middle j_agree">', "<span><em>\u540c \u610f</em></span>", "</a>", '<a href="javascript:;" class="btn_sub btn_middle j_refuse">', "<span><em>\u62d2 \u7edd</em></span>", "</a>", "</div>", "</div>"],
		initial: function() {},
		registNextFn: function(i, e) {
			this.nextFnStack.push({
				fn: i,
				context: e
			})
		},
		show: function() {
			this.dialog = new $.dialog({
				holderClassName: "paypostAgreeDialog",
				html: this.tpl.join(""),
				title: "\u4f7f\u7528\u987b\u77e5",
				width: 550,
				height: 270,
				draggable: !1
			}), this._bindDialogEvents()
		},
		_bindDialogEvents: function() {
			var i = this;
			this.dialog.element.find(".j_agree").one("click", function() {
				$.post("/diamond/submit/paypost/agree", {
					tbs: PageData.tbs
				});
				var e = i.requireInstance("encourage-thread/widget/paypost_data").getInstance();
				e.set("hasAgree", 1), i._fireNextFn(), i.dialog.close()
			}), this.dialog.element.find(".j_refuse").one("click", function() {
				i.dialog.close()
			})
		},
		_fireNextFn: function() {
			_.forEach(this.nextFnStack, function(i) {
				i.fn.call(i.context)
			})
		}
	}
});
_.Module.define({
	path: "encourage-thread/widget/paypost_editor",
	requires: ["encourage-thread/widget/paypost_data", "tbui/widget/bubble_tip"],
	sub: {
		FEE_EDITOR_ID: "ueditor_fee_replace",
		EDITOR_ID: "ueditor_replace",
		editor: null,
		opt: {},
		initial: function(t) {
			this.opt = t, this.paypostData = this.requireInstance("encourage-thread/widget/paypost_data").getInstance()
		},
		showEditor: function() {
			if(this.normalEditor = UE.getEditor("ueditor_replace"), this.opt.isInitialed) this.feeEditor = UE.getEditor(this.FEE_EDITOR_ID);
			else {
				$("<div />").tbattr({
					id: this.FEE_EDITOR_ID
				}).appendTo($(".old_style_wrapper")), this.feeEditor = UE.getEditor("ueditor_fee_replace", {
					dontSavePictureToYunAlbum: !0,
					heightLimit: !0,
					toolbar: ["attachment", "image", "video", "music", "scrawl"]
				});
				var t = $(this.feeEditor.container);
				t.addClass("paypost-fee-editor"), t.find(".edui-body-container").css({
					minHeight: 71
				}), this._renderTdouInput(t), this._bindEvents(t), this.feeEditor.ready(function() {
					this.restoreDraft()
				}), this.feeEditor.enableHeightLimit(300), this.feeEditor.addListener("focus", this._editorFocusHandler)
			}
			$(this.normalEditor.container).find(".edui-editor-body").removeClass("body-container-focus").css({
				height: 71,
				minHeight: 71
			}), $(this.normalEditor.container).find(".edui-body-container").css({
				minHeight: 55
			}), $(this.feeEditor.container).find(".edui-editor-body").css({
				height: 71,
				minHeight: 71
			}), $(this.feeEditor.container).addClass("editor-active"), $(this.normalEditor.container).addClass("has-paypost-editor"), this.paypostData.set("isPaypost", 1), this.normalEditor.addListener("focus", this._editorFocusHandler)
		},
		_editorFocusHandler: function() {
			var t = $(this.container),
				i = t.siblings(),
				e = t.find(".edui-editor-body").height(),
				o = i.find(".edui-editor-body").height();
			e += 10, o -= 10, e = 81 > e ? 81 : e, e = e > 342 ? 342 : e, o = 61 > o ? 61 : o, o = o > 332 ? 332 : o, t.find(".edui-editor-body").css({
				height: e,
				minHeight: 81
			}), i.find(".edui-editor-body").css({
				height: o,
				minHeight: 61
			})
		},
		hiddenEditor: function() {
			this.normalEditor = UE.getEditor("ueditor_replace"), this.feeEditor = UE.getEditor(this.FEE_EDITOR_ID), $(this.normalEditor.container).find(".edui-editor-body").css({
				height: 220
			}), $(this.normalEditor.container).find(".edui-body-container").css({
				minHeight: 204
			}), $(this.feeEditor.container).removeClass("editor-active"), this.paypostData.set("isPaypost", 0), this.normalEditor.removeListener("focus", this._editorFocusHandler)
		},
		_renderTdouInput: function(t) {
			var i = this,
				e = $('<div class="clearfix"></div>'),
				o = t.find(".edui-toolbar").addClass("edui-toolbar-float-left").wrap(e),
				a = '<p class="paypost_tdou_ipt_area">   <span>\u4ee5\u4e0b\u533a\u57df\u4ed8\u8d39\u540e\u53ef\u89c1</span>   <span>     \u4ef7\u683c:   </span>   <input class="form-control j_paypost_tdou_ipt" type="text" maxlength="8" value="500" />   T\u8c46 </p>';
			$(a).insertBefore(o);
			var s = '<div class="paypost_tdou_tips">   *\u6bcf\u552e\u51fa\u4e00\u6b21\uff0c\u4f60\u5c06\u6536\u5230 <span class="orange_text j_paypost_diamond">250</span> \u84dd\u94bb <div class="j_paypost_faq paypost_faq_wrap"><div class="j_paypost_tip_bubble paypost_tip_bubble_wrap">   </div><i class="icon_faq"></i></div>   <span class="orange_text j_paypost_exp">+2</span> \u672c\u5427\u7ecf\u9a8c </div>';
			$(s).appendTo(t);
			var d = '<div class="paypost_editor_close_wrap"><a href="javascript:;" class="paypost_editor_close j_paypost_editor_close"></a></div>',
				r = $(d).insertAfter(o);
			r.find(".j_paypost_editor_close").on("click", function() {
				i.hiddenEditor()
			})
		},
		_bindEvents: function(t) {
			var i = this,
				e = PosterContext.getContext(),
				o = {
					content: "\u53ef\u7528\u4e8e1:1\u5151\u6362T\u8c46<br/>\uff08\u53ef\u5728\u4e2a\u4eba\u4e2d\u5fc3\u5151\u6362\uff1a<a href='/home/main?un=" + encodeURIComponent(e.user.name) + "&ie=utf-8&fr=paypost' target='_blank'>\u524d\u5f80\u67e5\u770b</a>\uff09",
					arrow_dir: "up",
					bubble_css: {
						top: 14,
						right: -73,
						width: 180,
						"text-align": "center"
					},
					arrow_pos: {
						left: 90
					},
					attr: " id='paypost_tip_bubble' ",
					wrap: $(".j_paypost_tip_bubble"),
					level: 1,
					arrowReq: !0
				},
				a = this.requireInstance("tbui/widget/bubble_tip", o);
			t.find(".j_paypost_faq").on("mouseover", function() {
				a.showBubble()
			}).on("mouseout", function() {
				a.hideBubble()
			});
			var s = t.find(".j_paypost_diamond"),
				d = t.find(".j_paypost_exp");
			t.find(".j_paypost_tdou_ipt").on("keydown", function(t) {
				var i = t.which,
					e = !1;
				return t.shiftKey && (9 == i && (e = !0), e = !1), (57 >= i && i >= 48 || 37 == i || 39 == i || 8 == i || 9 == i || 46 == i || 105 >= i && i >= 96 || 229 == i) && (e = !0), e
			}).on("keyup change paste", function() {
				var t = $.trim($(this).val());
				if(t) {
					t = t.replace(/\D/g, ""), $(this).val(t);
					var e = i._calcDiamondAndExp(t);
					s.text(e.diamond), d.text("+" + e.exp)
				}
			})
		},
		_calcDiamondAndExp: function(t) {
			return {
				diamond: Math.floor(.5 * t),
				exp: Math.floor(.5 * t * .01 * .8)
			}
		}
	}
});
_.Module.define({
	path: "encourage-thread/widget/paypost",
	requires: ["poster/widget/post_manager", "encourage-payment/widget/tbean_safe_ajax", "encourage-thread/widget/paypost_data", "encourage-thread/widget/paypost_editor", "encourage-thread/widget/paypost_agree_dialog"],
	sub: {
		feeEditor: null,
		_options: {
			isPaypost: 1,
			needPaypostAgree: 0
		},
		initial: function(t, e, i) {
			t = t || window.UE, e = e || window.EditorUI;
			this.initPlugin(t, this), this.initLayer(e, this), this.initModel(e, this), this.initAdapter(t, e, this), this._options = $.extend({}, this._options, i), this.postManager = this.requireInstance("poster/widget/post_manager"), this.initEditorReady(), this.initPostDataProcess(), this.initPostValidate(), this.initPostSuccess()
		},
		initPlugin: function() {},
		initLayer: function(t, e) {
			t.registerLayer("paypost", function(t, i) {
				var a = '<div style="padding:10px;">\u54a6\uff0c\u6b64\u529f\u80fd\u9700\u8981\u62e5\u6709\u672c\u54276\u7ea7\u5934\u8854\u624d\u80fd\u4f7f\u7528\uff0c\u518d\u52aa\u529b\u4e00\u4e0b\uff01&nbsp;<a href="//tieba.baidu.com/f/like/level?kw=#{name}&ie=utf-8#level_main" target="_blank">\u67e5\u770b\u5347\u7ea7\u79d8\u7c4d</a></div>',
					n = !1;
				t.bind("show", function() {
					if(i.user.level >= 6) {
						var t = e.requireInstance("encourage-payment/widget/tbean_safe_ajax", {
							mobileMsg: "\u7ed1\u5b9a\u624b\u673a\u662f\u76ee\u524d\u6700\u7b80\u5355\u6709\u6548\u964d\u4f4e\u8d26\u53f7\u88ab\u76d7\u98ce\u9669\u7684\u65b9\u6cd5~\u7ed1\u5b9a\u540e\u5373\u53ef\u4f7f\u7528\u201c\u4ed8\u8d39\u53ef\u89c1\u201d\u529f\u80fd"
						});
						t.post("/diamond/paypost/verify", {
							tbs: i.tbs,
							forum_id: i.forum.id
						}, function(t) {
							0 == t.errno && o()
						})
					}
				});
				var o = function() {
					var t = e.requireInstance("encourage-thread/widget/paypost_data"),
						i = t.getInstance().get("isPaypost"),
						a = e.requireInstance("encourage-thread/widget/paypost_editor", {
							isInitialed: n
						});
					i || n || (n = !0), (i = !i) ? a.showEditor() : a.hiddenEditor()
				};
				if(i.user.level < 6) {
					var r = $.eduipopup().on("beforeshow", function() {
						var t = r.edui().getBodyContainer();
						t.html($.tb.format(a, i.forum))
					});
					t.setWidget(r)
				}
			})
		},
		initModel: function(t) {
			t.registerModel("paypost", function(e, i) {
				var a = new t.EditorModel;
				t.bindLayer("paypost", a);
				var n = $.eduibutton({
					icon: "paypost",
					title: "\u4ed8\u8d39\u53ef\u89c1"
				});
				return "frs" === e.product && i.paypost || n.hide(), a.setButton(n), a
			})
		},
		initAdapter: function(t, e) {
			t.registerUI("paypost", function(t) {
				var i = this,
					a = e.getModel(t),
					n = a.getButton(),
					o = a.getWidget();
				return n.click(function() {
					a.trigger("show"), o && (o.parent().length || i.$container.find(".edui-dialog-container").append(o), o.css("zIndex", i.options.zIndex + 1).edui().show(n, {
						offsetTop: -10,
						caretLeft: 20,
						caretTop: -8
					})), $.stats.track("paypost_btn", "ueditor")
				}), n.edui().register("click", n, function() {
					o && o.hide()
				}), n
			})
		},
		initEditorReady: function() {
			var t = this;
			this.postManager.addEditorReady(function(e) {
				var i = (e.editor || {}, e.context || {}, e.poster || {});
				if(i && i.$root) {
					var a = i.$root.find(".j_draft"),
						n = a.children(".j_clear"),
						o = t.requireInstance("encourage-thread/widget/paypost_data").getInstance();
					n.on("click", function() {
						o.get("isPaypost") && (t.feeEditor = t.feeEditor || UE.getEditor("ueditor_fee_replace"), t.feeEditor.setContent(""), t.feeEditor.clearDraft())
					})
				}
			})
		},
		initPostDataProcess: function() {
			var t = this;
			this.postManager.addPostDataProcess(function(e) {
				var i = e.editorExtendContent || {},
					a = {},
					n = t.requireInstance("encourage-thread/widget/paypost_data").getInstance();
				if(n.get("isPaypost")) {
					var o = t.feeEditor || UE.getEditor("ueditor_fee_replace");
					a.is_paypost = 1, a.secret = o.getContentUbb(), a.score = $(o.container).find(".j_paypost_tdou_ipt").val();
					var r = o.getExtendContent();
					if(r.attachments) {
						var s = JSON.parse(r.attachments);
						a.files = JSON.stringify(JSON.parse(i.attachments).concat(s)), a.secret_files = JSON.stringify(_.pluck(s, "fs_id"))
					}
				}
				return 1 === t._options.isPaypost && (a.is_paypost = 1), a
			})
		},
		initPostValidate: function() {
			var t = this;
			this.postManager.addPostValidate(function(e) {
				var i = (e.context || {}, e.editorExtendContent || {}, e.poster || {}),
					a = t.requireInstance("encourage-thread/widget/paypost_data").getInstance();
				if(a.get("isPaypost")) {
					t.feeEditor = t.feeEditor || UE.getEditor("ueditor_fee_replace");
					var n = $(t.feeEditor.container),
						o = n.find(".j_paypost_tdou_ipt").val();
					if(100 > o) return "\u9690\u85cf\u5185\u5bb9\u552e\u4ef7\u987b\u81f3\u5c11100T\u8c46";
					if(o > 1e7) return "\u9690\u85cf\u5185\u5bb9\u552e\u4ef7\u4e0d\u5f97\u9ad8\u4e8e10000000T\u8c46";
					var r = t.feeEditor.getExtendContent();
					if(0 == $.trim(t.feeEditor.getContent()).length && "[]" == r.attachments) return "\u4ed8\u8d39\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a";
					if(t._options.needPaypostAgree && !a.get("hasAgree")) {
						var s = t.requireInstance("encourage-thread/widget/paypost_agree_dialog");
						return s.registNextFn(i.post, i), s.show(), ""
					}
				}
				return !0
			})
		},
		initPostSuccess: function() {
			var t = this;
			this.postManager.addPostSuccess(function() {
				var e = t.requireInstance("encourage-thread/widget/paypost_data").getInstance();
				e.get("isPaypost") && (t.feeEditor && t.feeEditor.setContent(""), t.feeEditor && t.feeEditor.clearDraft())
			})
		}
	}
});